
/**
 * temp monitorDispatch
 */
import posts from '@/plugins/request'

// initial state
const state = {
  monitorList: {
    data: [],
    total: 0
  }
}
// getters
const getters = {
  getMonitorList: state => state.monitorList
}
// actions
const actions = {
  async submitDispatch({commit}, param) {
    let result = await posts.postMonitorDispatch(param)
    return result
  },
  async getDispatchSelect({ commit }) {
    let data = await posts.fetchDispatchSelect()
    return data
  },
  async fetchMonitorDispatchList({ commit }, param) {
    let data = await posts.fetchMonitorDispatchList(param)
    commit('changeMonitorList', data)
  },
}

// mutations
const mutations = {
  changeMonitorList(state, data) {
    state.monitorList.data = data.rows
    state.monitorList.total = data.total
  }
}
export default {
  state,
  getters,
  actions,
  mutations
}